package com.baiye.template.common;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

/**
 * @author GUOZHIPENG
 * @version 1.0
 * @date 2021/9/17 11:29
 */

@Component
@PropertySource("classpath:/alipay.properties")
public class AliPayProperties implements InitializingBean {
    @Value("${alipay.app_id}")
    public  String app_id;

    @Value("${alipay.merchant_private_key}")
    public  String merchant_private_key;

    @Value("${alipay.alipay_public_key}")
    public  String alipay_public_key;

    @Value("${alipay.notify_url}")
    public  String notify_url;

    @Value("${alipay.return_url}")
    public  String return_url;

    @Value("${alipay.sign_type}")
    public  String sign_type;

    @Value("${alipay.charset}")
    public  String charset;

    @Value("${alipay.format}")
    public  String format;

    @Value("${alipay.gatewayUrl}")
    public  String gatewayUrl;

    @Value("${alipay.log_path}")
    public  String log_path;


    public static String APP_ID;
    public static String MERCHANT_PRIVATE_KEY;
    public static String ALIPAY_PUBLIC_KEY;
    public static String NOTIFY_URL;
    public static String RETURN_URL;
    public static String SIGN_TYPE;
    public static String CHARSET;
    public static String FORMAT;
    public static String GATEWAYURL;
    public static String LOG_PATH;

    @Override
    public void afterPropertiesSet() throws Exception {
        APP_ID=app_id;
        MERCHANT_PRIVATE_KEY=merchant_private_key;
        ALIPAY_PUBLIC_KEY=alipay_public_key;
        NOTIFY_URL=notify_url;
        RETURN_URL=return_url;
        SIGN_TYPE=sign_type;
        CHARSET=charset;
        FORMAT=format;
        GATEWAYURL=gatewayUrl;
        LOG_PATH=log_path;
    }
}
